package org.lq.ssm.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 *使用注解声明时Filter类无法定义顺序。
*/
@WebFilter(filterName = "LoginFilter",urlPatterns="/*")
public class LoginFilter implements javax.servlet.Filter {
    @Override
    public void destroy() {
        System.out.println("销毁登录过滤器");
    }

    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
        System.out.println("第一个过滤器");
        chain.doFilter(req, resp);
    }

    @Override
    public void init(FilterConfig config) throws ServletException {
        System.out.println("登录过滤器初始化");
    }

}
